<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加</title>
    {include file="include/top"}

</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-tags" id="layuiadmin-app-form-tags"
     style="padding-top: 30px; text-align: center;">
    <div class="layui-form-item">
        <label class="layui-form-label">上级ID</label>
        <div class="layui-input-inline">
            <input type="number" readonly disabled value="{$id}" name="pathid" lay-verify="required"
                   placeholder="请输入..." autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">分类名</label>
        <div class="layui-input-inline">
            <input type="text" value="{if $gid>0}{$rule['title']}{/if}" name="tags" lay-verify="required"
                   placeholder="请输入..." autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--    <div class="layui-form-item">-->
    <!--      <label class="layui-form-label">内部分类</label>-->
    <!--      <div class="layui-input-inline">-->
    <!--        {include file="include/cid"}-->
    <!--      </div>-->
    <!--    </div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">规则</label>
        <div class="layui-input-inline">
            <input type="text" value="{if isset($rule.rule)}{$rule.rule}{/if}" name="rule" lay-verify="required"
                   placeholder="请输入..." autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <input type="text" value="{if isset($rule.sortid)}{$rule.sortid}{/if}" name="sortid" lay-verify="required"
                   placeholder="数字也大越靠前 默认0" autocomplete="off" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">附件</label>
        <div class="layui-input-inline">
            <input type="text" name="file" id="file" value="{$rule.file?$rule.file:''}" lay-verify="required"
                   placeholder="请输入图片" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-inline">
            <input type="text" value="{if isset($rule.content)}{$rule.content}{/if}" name="content" lay-verify="required"
                   placeholder="系统备注和计算说明" autocomplete="off" class="layui-input">
        </div>
    </div>

</div>

{include file="include/js"}
<script>
    layui.config({
        base: '../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload'], function () {
        var $ = layui.$
            , form = layui.form
            , upload = layui.upload
        upload.render({
            elem: '#file'
            , url: '/includes/upload' //改成您自己的上传接口
            , before: function () {
                $load = layer.load();
            }
            , auto: true
            , exts: 'jpg|png' //只允许上传压缩文件
            //,multiple: true
            // ,bindAction: '#test9'
            , done: function (res) {
                layer.close($load);
                if (res.code == 1) {
                    layer.msg(res.msg);
                } else {
                    layer.msg('上传成功');
                    $("#file").val(res.data.src);
                }
            }, error: function () {
                layer.close($load)
            }
        });
    })
</script>
</body>
</html>